﻿@using AtletIS.Shared.Helpers
@model MvcAtletIS.Models.LiveModel
@if (Model != null)
{ 
    <div id="main">

        <!-- HEADER -->
        <div class="header-info">
            <p class="float-right">@ViewRes.SharedStrings.StartList</p>
            <p class="align-left"><strong>@Model.ActiveDiscipline.Name</strong></p>
        </div>
            
        <div id="col2">
            <ul>
                @if (Model.Performances != null && Model.Performances.Count > 0)
                {
                    foreach (var item in Model.Performances)
                    { 
                        <li class="main-info">
                        
                            <!-- StartNumber -->
                            @if (item.StartNumber.HasValue && item.StartNumber.Value != 0)
                            {
                                <div class="order-box">@item.StartNumber</div>
                            }
                            else
                            {
                                <div class="order-box">&zwnj;</div>
                            }

                            <img class="picture-box" src="@Url.Content("~/Content/flags/24px/" + item.CountryId + ".png")" alt="@item.CountryId" />
                            <div class="lane-box"></div>

                            <div class="competitor-box">
                                <div class="name-box">@item.Surname.ToUpper() @item.FirstName</div>
                                @if(Model.ActiveCompetition.ClubsCountries)
                                {
                                    <div class="competitor-info-box">@item.Birthdate.Value.Year &middot; @item.Club</div>
                                }
                                else
                                {
                                    <div class="competitor-info-box">@item.Birthdate.Value.Year &middot; @item.CountryId</div>
                                }
                            </div>

                            <!-- SB -->
                            @if (item.SB.HasValue && item.SB.Value != 0)
                            {
                                <div class="prefix-box">SB</div>
                                <div class="sb-box">@PrintHelper.PrintResult(item.SB.Value.ToString(), Model.ActiveDiscipline.DisciplineCode.Value)</div>
                            }
                            else
                            { 
                                <div style="float: left; width: 130px; margin: 4px 10px;">&zwj;</div>
                            }

                            <!-- PB -->
                            @if (item.PB.HasValue && item.PB.Value != 0)
                            {
                                <div class="prefix-box">PB</div>
                                <div class="sb-box">@PrintHelper.PrintResult(item.PB.Value.ToString(), Model.ActiveDiscipline.DisciplineCode.Value)</div>
                            }
                        
                        </li>
                    }
                }
            </ul>
        </div>

        <!-- FOOTER -->
        <div class="footer-info">
            <p class="float-left">@ViewRes.SharedStrings.PerformancesCount: @Model.PerformancesCount</p>
            <p class="float-right">@ViewRes.SharedStrings.Page: @(Model.Performances.PageCount < Model.Performances.PageNumber ? 0 : Model.Performances.PageNumber) / @Model.Performances.PageCount</p>
            <p class="align-center">&copy AtletIS @DateTime.Now.Year</p>
        </div>

        <!-- LOGO -->
        <div id="logo-box">
            <a href="http://www.hrdosport.sk" target="_blank"><img src="@Url.Content("~/Content/hrdosport_live.png")" alt="Hrdošport" height="40px" /></a>
        </div>

        <!-- PAGING -->
        <div id="paging-box">
            @if (Model.Performances.HasNextPage)
            {
                @Html.ActionLink(">>", "Index", new { CompetitionId = Model.ActiveCompetition.ID, DisciplineId = Model.ActiveDiscipline.ID, Page = Model.Performances.PageCount, Code = Model.Code })
                @Html.Raw(" ");
                @Html.ActionLink(">", "Index", new { CompetitionId = Model.ActiveCompetition.ID, DisciplineId = Model.ActiveDiscipline.ID, Page = Model.Performances.PageNumber + 1, Code = Model.Code })
            }
                
            @if (Model.Performances.HasPreviousPage)
            {
                @Html.ActionLink("<", "Index", new { CompetitionId = Model.ActiveCompetition.ID, DisciplineId = Model.ActiveDiscipline.ID, Page = Model.Performances.PageNumber - 1, Code = Model.Code })
                @Html.Raw(" ");                        
                @Html.ActionLink("<<", "Index", new { CompetitionId = Model.ActiveCompetition.ID, DisciplineId = Model.ActiveDiscipline.ID, Page = 1, Code = Model.Code })
            }
        </div>

    </div>
}